Dynomotion

Group: DynoMotion Message: 4911 From: gracemckay Date: 5/11/2012
Subject: Re: Rotary encoder setup
Thanks Tom,

This helps a lot. I now have the encoder responding on the axis screen when it is rotated, just as you said. And your code gives some response as well. But unlike a CNC, I don't need destinations on this machine. What I need is to modulate the rotation speed. So we start with a constant speed, and then the encoder, responding to it's mechanical input, would speed up or slow down the motor slightly. This will compensate for the film pack moving from the feed reel to the take-up, and keep a constant tension on the film as it moves through the system. I am having trouble translating your code into this type of action. Could I ask for another code sample based on this?

Grace

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> JP7 Pins 11&12 would be encoder input 2.  You would need to conifigure an axis for Encoder Input and InputChan0=2. Then the Axis Screen should display the encoder position.  If you turn the encoder the encoder should count and if you turn the encoder back to where you started the count should return to the orignal value.  I wouldn't be concerned that other floating unused inputs toggle randomly.
>  
> I forget what type of amplifiers you have.  Open loop step/dir inputs I assume?
>  
> You might start with something simple like:
>  
> #include "KMotionDef.h"
> #define FACTOR 1.0
> main()
> {
>     double Target=ch2->Dest;
>  
>     for (;;)  // loop forever
>     {
>         WaitNextTimeSlice();
>         // advance Target position smoothly
>         // at rate determined by Encoder #2
>         Target += FACTOR * ch2->Position;
>   
>         MoveExp(2,Target,0.1);
>     }
> }
>  
> Regards
> TK
>
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, May 10, 2012 1:43 PM
> Subject: [DynoMotion] Rotray encoder setup
>
>
>  
> Hi Tom,
>
> I am still working on my scanner project. The current phase is incorporating a rotary encoder to sense film tension and control the speed of the take-up reel(axis2). I have added a photo of my wiring (in the scanner folder), based on a thread of a month ago about linear encoding. It is being seen by Kflop, but I am not sure if it it working correctly. I uploaded a video to the files/FilmScannerProject folder to show you the response I am getting. The range of motion of the encoder will be approximate 30 degrees. The A channel is set to I/O 4 , JP7 pin 11. The B channel to I/O 5 JP7 pin 12. But as you will see in the video, the encoder is switching bits 3, 4, 5 and 6. Is this proper behavior?
> I suspect something is not quite right. What should my next steps be?
>
> If this is correct, do you have a sample c-program that would be useful to use the encoder to control the axis2 speed?
>
> Thanks!
> Grace
>
Group: DynoMotion Message: 4912 From: Tom Kerekes Date: 5/11/2012
Subject: Re: Rotary encoder setup
Hi Grace,
 
I was thinking your application would be much like an old Magnetic Tape Drive I've watched years ago.  There are 3 motors:  #1 for the capstan that does the recording,  #2 for the out feed reel.  #3 for the takeup reel.  #1 is the master and is fairly straight forward - just command it as a normal axis trajectory to accelerate to constant speed and do the recording.  The other two motors act as slaves and work to keep the "slack" as measured by your encoder within a certain range.  The program I provided was intended for axes #2 and #3.  The encoder is basically a speed control.  As axis #1 starts to move it will induce slack, this wil cause axis #2 to start moving to reduce the slack and so forth.
 
Isn't his what you need?
 
Regards
TK

Group: DynoMotion Message: 4914 From: gracemckay Date: 5/11/2012
Subject: Re: Rotary encoder setup
It IS what I need, and I now have it sort-of working. Before, the motor was responding with a huge overshoot, which I just figured out. I now have adjusted the ch2 input gain way down, to .01. The motor is now behaving more like you intended. A positive move to the encoder rotates clockwise, a return to zero stops the motor, and a negative move turns the motor ccw. Very cool! Thank you so much! I now have to do some hardware fab to build this into the machine, and then further testing! I hope to report back after that. Thanks again!

Grace



--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> I was thinking your application would be much like an old Magnetic Tape Drive I've watched years ago.  There are 3 motors:  #1 for the capstan that does the recording,  #2 for the out feed reel.  #3 for the takeup reel.  #1 is the master and is fairly straight forward - just command it as a normal axis trajectory to accelerate to constant speed and do the recording.  The other two motors act as slaves and work to keep the "slack" as measured by your encoder within a certain range.  The program I provided was intended for axes #2 and #3.  The encoder is basically a speed control.  As axis #1 starts to move it will induce slack, this wil cause axis #2 to start moving to reduce the slack and so forth.
>  
> Isn't his what you need?
>  
> Regards
> TK
>
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Friday, May 11, 2012 12:11 PM
> Subject: [DynoMotion] Re: Rotary encoder setup
>
>
>  
> Thanks Tom,
>
> This helps a lot. I now have the encoder responding on the axis screen when it is rotated, just as you said. And your code gives some response as well. But unlike a CNC, I don't need destinations on this machine. What I need is to modulate the rotation speed. So we start with a constant speed, and then the encoder, responding to it's mechanical input, would speed up or slow down the motor slightly. This will compensate for the film pack moving from the feed reel to the take-up, and keep a constant tension on the film as it moves through the system. I am having trouble translating your code into this type of action. Could I ask for another code sample based on this?
>
> Grace
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
> >  
> > JP7 Pins 11&12 would be encoder input 2.  You would need to conifigure an axis for Encoder Input and InputChan0=2. Then the Axis Screen should display the encoder position.  If you turn the encoder the encoder should count and if you turn the encoder back to where you started the count should return to the orignal value.  I wouldn't be concerned that other floating unused inputs toggle randomly.
> >  
> > I forget what type of amplifiers you have.  Open loop step/dir inputs I assume?
> >  
> > You might start with something simple like:
> >  
> > #include "KMotionDef.h"
> > #define FACTOR 1.0
> > main()
> > {
> >     double Target=ch2->Dest;
> >  
> >     for (;;)  // loop forever
> >     {
> >         WaitNextTimeSlice();
> >         // advance Target position smoothly
> >         // at rate determined by Encoder #2
> >         Target += FACTOR * ch2->Position;
> >   
> >         MoveExp(2,Target,0.1);
> >     }
> > }
> >  
> > Regards
> > TK
> >
> > From: gracemckay <grace@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, May 10, 2012 1:43 PM
> > Subject: [DynoMotion] Rotray encoder setup
> >
> >
> >  
> > Hi Tom,
> >
> > I am still working on my scanner project. The current phase is incorporating a rotary encoder to sense film tension and control the speed of the take-up reel(axis2). I have added a photo of my wiring (in the scanner folder), based on a thread of a month ago about linear encoding. It is being seen by Kflop, but I am not sure if it it working correctly. I uploaded a video to the files/FilmScannerProject folder to show you the response I am getting. The range of motion of the encoder will be approximate 30 degrees. The A channel is set to I/O 4 , JP7 pin 11. The B channel to I/O 5 JP7 pin 12. But as you will see in the video, the encoder is switching bits 3, 4, 5 and 6. Is this proper behavior?
> > I suspect something is not quite right. What should my next steps be?
> >
> > If this is correct, do you have a sample c-program that would be useful to use the encoder to control the axis2 speed?
> >
> > Thanks!
> > Grace
> >
>